package com.ss;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.io.File;
//import javax.media.jai.JAI;
//import javax.media.jai.PlanarImage;
//import javax.media.jai.RenderedOp;



public class CheckAvail
{ 
	static Connection currentCon = null; 
	static ResultSet rs = null; 
	
	public static UserBean login(UserBean bean) {
	
	//preparing some objects for connection 
	Statement stmt = null; 
	
	String username = bean.getUsername(); 
	String password = bean.getPassword();
	String Name = bean.getName();
	String email = bean.getEmail();
	String image = bean.getImageFile();
	PreparedStatement ps;
	Statement stmt1;
		try 
		{ 
			//connect to DB 
			currentCon = connectionManager.getConnection(); 
			stmt=currentCon.createStatement(); 
			Connection con = null;
			stmt1 = con.createStatement();
			
			//creating prepared statement and inserting data into the database
	        ps = con.prepareStatement("INSERT into UserTable(Name,Username,Password,E-mail,Image) VALUES(?,?,?,?,?)");
	        ps.setString(1, Name);
	        ps.setString(2, username);
	        ps.setString(3, password);
	        ps.setString(4, email);
	        ps.setString(5, image);
	        ps.executeUpdate();
	        stmt1.close();
			
		}
			catch (Exception e)
	        {
	            e.printStackTrace();
	            return null;
	        }
			
		return bean;
	
	}
	
}